<div class="docs-section">
    <h1 id="dataOperation" class="page-header">数据操作</h1>

    <h2 id="dataOperation-base">基本说明</h2>
    <p>
        常用数据类型的判断、处理及相互转换
    </p>

    <h2 id="dataOperation-emptyObj">清空对象</h2>
    <p>
        清空对象的所有属性，返回清空后的对象
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.emptyObj(obj)</code>
        </pre>
    </div>

    <h2 id="dataOperation-isNumber">是否为数字</h2>
    <p>
        判断一个对象是否为数字，返回Boolean类型
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.isNumber(number)</code>
        </pre>
    </div>

    <h2 id="dataOperation-isPrime">是否质数</h2>
    <p>
        判断一个数字是否为质数，返回Boolean类型
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.isPrime(number)</code>
        </pre>
    </div>

    <h2 id="dataOperation-isInt">是否整数</h2>
    <p>
        判断一个数字是否为整数，返回Boolean类型
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.isInt(obj)</code>
        </pre>
    </div>

    <h2 id="dataOperation-isPositiveNumber">是否为非负数</h2>
    <p>
        判断一个数字是否为非负数，返回Boolean类型
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.isNumber(number)</code>
        </pre>
    </div>

    <h2 id="dataOperation-compareDate">比较日期先后</h2>
    <p>
        判断两个日期的先后，返回number类型。<br/>
        当date1早于date2时，返回值小于0；<br/>
        当date1等于date2时，返回值等于0；<br/>
        当date1晚于date2时，返回值大于0；
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.compareDate(date1, date2)</code>
        </pre>
    </div>

    <h2 id="dataOperation-typeof">获取数据类型</h2>
    <p>
        判断一个对象的数据类型，返回String类型。String | number | Boolean | undefined | null | array | function | object
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.typeof(obj)</code>
        </pre>
    </div>

    <h2 id="dataOperation-objInArray">是否在数组中</h2>
    <p>
        判断一个对象是否在数组中，返回Boolean类型。
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.objInArray(obj, array, compareFunction)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>obj</td><td>Object</td><td>无</td>
        </tr>
        <tr>
            <td>array</td><td>Array</td><td>无</td>
        </tr>
        <tr>
            <td>compareFunction</td><td>Function</td>
            <td>对象比较方法，返回Boolean。可为空，默认为<pre class="not-code">
function(o1, o2){
    return o1 == o2;
}</pre></td>
        </tr>
        </tbody>
    </table>

    <h2 id="dataOperation-objIndexOfArray">获取在数组中游标</h2>
    <p>
        获取一个对象是否在数组中游标，找不到时返回-1。返回number类型。
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.objIndexOfArray(obj, array, compareFunction)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>obj</td><td>Object</td><td>无</td>
        </tr>
        <tr>
            <td>array</td><td>Array</td><td>无</td>
        </tr>
        <tr>
            <td>compareFunction</td><td>Function</td>
            <td>对象比较方法，返回Boolean。可为空，默认为<pre class="not-code">
function(o1, o2){
    return o1 == o2;
}</pre></td>
        </tr>
        </tbody>
    </table>

    <h2 id="dataOperation-dateDifference">获取时间差</h2>
    <p>
        获取两个时间的间隔，返回String类型。
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.dateDifference(date1, date2)</code>
        </pre>
    </div>

    <h2 id="dataOperation-string2json">string转json</h2>
    <p>
        字符串转json
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.string2json(str)</code>
        </pre>
    </div>

    <h2 id="dataOperation-json2string">json转string</h2>
    <p>
        json转字符串
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.json2string(json, quote)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>json</td><td>Object</td><td>无</td>
        </tr>
        <tr>
            <td>quote</td><td>String</td><td>字符串中的双引号是否添加转义，"single" | "double" | ""，可为空，默认为""</td>
        </tr>
        </tbody>
    </table>

    <h2 id="dataOperation-string2date">string转date</h2>
    <p>
        string转date
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.string2date(str, format)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>str</td><td>String</td><td>无</td>
        </tr>
        <tr>
            <td>format</td><td>String</td><td>可为空，默认为"yyyy-MM-dd hh:mm:ss"</td>
        </tr>
        </tbody>
    </table>

    <h2 id="dataOperation-date2string">date转string</h2>
    <p>
        date转string
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.date2string(date, format)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>date</td><td>Date</td><td>无</td>
        </tr>
        <tr>
            <td>format</td><td>String</td><td>可为空，默认为"yyyy-MM-dd hh:mm:ss"</td>
        </tr>
        </tbody>
    </table>

    <h2 id="dataOperation-longDate2string">longDate转string</h2>
    <p>
        longDate转string
    </p>
    <div class="docs-code">
        <pre>
            <code class="js">Dolphin.longDate2string(long, format)</code>
        </pre>
    </div>
    <table class="table table-bordered table-striped docs-param">
        <thead>
        <tr>
            <th>名称</th>
            <th style="width:120px;">类型</th>
            <th>描述</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>long</td><td>number</td><td>无</td>
        </tr>
        <tr>
            <td>format</td><td>String</td><td>可为空，默认为"yyyy-MM-dd hh:mm:ss"</td>
        </tr>
        </tbody>
    </table>
</div>